import type { PlusColumn } from 'plus-pro-components'

import { ref } from 'vue'

export function useForm() {
    const activeStatusList = [
        {
            label: '正常',
            value: 1,
        },
        {
            label: '禁用',
            value: 0,
        },
    ]

    const schema: PlusColumn[] = [
        {
            colProps: {
                span: 8,
            },
            fieldProps: {
                placeholder: '请输入',
            },
            label: '登录名称',
            prop: 'userName',
            valueType: 'copy',
        },
        {
            colProps: {
                span: 8,
            },
            fieldProps: {
                placeholder: '请输入',
            },
            label: '手机号',
            prop: 'phone',
            valueType: 'copy',
        },
        {
            label: '状态',
            colProps: {
                span: 8,
            },
            options: activeStatusList,
            prop: 'activeState',
            valueType: 'select',
        },
        {
            fieldProps: {
                'endPlaceholder': '结束时间',
                'startPlaceholder': '开始时间',
                'type': 'daterange',
                'value-format': 'YYYY-MM-DD',
            },
            colProps: {
                span: 8,
            },
            label: '创建时间',
            prop: 'createTime',
            valueType: 'date-picker',
        },

        // {
        //     colProps: {
        //         span: 8,
        //     },
        //     fieldProps: {
        //         placeholder: '请输入',
        //     },
        //     label: '创建人',
        //     prop: 'createBy',
        //     valueType: 'copy',
        // },
    ] as const

    const form = ref({
        // deptId: '',
        // createBy: '',
        phone: '',
        userName: '',
        createTime: [],
        activeState: '',

    })
    return { form, schema }
}
